using Microsoft.Xna.Framework;

namespace Blood_Siege
{
    //The pause menu comes up over the top of the game,
    //giving the player options to resume or quit.

    class PauseMenuScreen : MenuScreen
    {

        //Constructor.
        public PauseMenuScreen()
            : base("Paused")
        {
            // Flag that there is no need for the game to transition
            // off when the pause menu is on top of it.
            IsPopup = true;

            // Create our menu entries.
            MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
            MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game");
            
            // Hook up menu event handlers.
            resumeGameMenuEntry.Selected += OnCancel;
            quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(resumeGameMenuEntry);
            MenuEntries.Add(quitGameMenuEntry);
        }


        //Event handler for when the Quit Game menu entry is selected.
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            LoadingScreen.Load(StateManager, false, null, new BackgroundScreen(), new MainMenuScreen());
        }

        //Draws the pause menu screen. This darkens down the gameplay screen
        //what is underneath us, and then chains to the base MenuScreen.Draw.
        public override void Draw(GameTime gameTime)
        {
            StateManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);

            base.Draw(gameTime);
        }
    }
}
